package com.qf.blog.entity;

import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import lombok.Data;

/**
 * @author Zhendong Song
 * @date 2023/6/2
 * @description
 */
@Data
public class BlogPage<T> extends Page<T> {
    private String path;

    private Integer from;
    private Integer to;
    public BlogPage() {
        // 初始化这个MyPage的时候设置每页显示的条数为5条
        super.setSize(5);
    }

    public Long getFrom()  {
        Long index = super.getCurrent() - 2;
        if (index <= 0) { // 最小是第一页
            return 1L;
        }
        return index;
    }
    public Long getTo()  {
        Long index = super.getCurrent() +2;
        if (index >= super.getPages()) { // 最小是第一页
            return super.getPages();
        }
        return index;
    }
}

